<template>
  <a-button @click="copy" size="small">复制</a-button>
</template>

<script setup>
  import { message } from 'ant-design-vue';

  const props = defineProps({
    text: {
      type: String,
      default: '',
    },
  });

  const copy = () => {
    navigator.clipboard.writeText(props.text).then(() => {
      message.success('复制成功');
    });
  };
</script>
